package com.sea.operate.service.impl;


import com.codecrane.core.web.BatchImportUtils;
import com.sea.operate.entity.Related;
import com.sea.operate.entity.RelatedMaterial;
import com.sea.operate.entity.RelatedMaterialDetail;
import com.sea.operate.mapper.RelatedMapper;
import com.sea.operate.mapper.RelatedMaterialMapper;
import com.sea.operate.service.RelatedMaterialService;
import com.sea.operate.service.RelatedService;
import com.sea.operate.service.RelatedSkuService;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.InputStream;
import java.util.List;


/**
 * @author 陈鸿飞
 */
@Service
public class RelatedMaterialServiceImpl implements RelatedMaterialService {

    @Autowired
    private RelatedMaterialMapper relatedMaterialMapper;

    @Override
    public List<RelatedMaterial> findByCnd(RelatedMaterial relatedMaterial) {
        return relatedMaterialMapper.findByCnd(relatedMaterial);
    }

    @Override
    public Integer save(RelatedMaterial relatedMaterial) {
        RelatedMaterial ma = findByListingChannel(relatedMaterial);
        if (null == ma) {
            relatedMaterialMapper.insert(relatedMaterial);
            return relatedMaterial.getId();
        } else {
            return ma.getId();
        }
    }

    @Override
    public RelatedMaterial findByListingChannel(RelatedMaterial relatedMaterial) {
        return relatedMaterialMapper.findByListingChannel(relatedMaterial);
    }

    @Override
    public List<RelatedMaterialDetail> exportFnSkuByProduceId(Integer produceId) {
        return null;
    }

    @Override
    public Integer updateModifyTime(Integer id) {
        return relatedMaterialMapper.updateModifyTime(id);
    }
}
